VERSION 5.00
Begin VB.Form FrmRemote 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Remote Server"
   ClientHeight    =   495
   ClientLeft      =   165
   ClientTop       =   420
   ClientWidth     =   1185
   Icon            =   "Form1.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   33
   ScaleMode       =   3  'Pixel
   ScaleWidth      =   79
   Visible         =   0   'False
   Begin VB.PictureBox picCursor 
      Appearance      =   0  'Flat
      AutoRedraw      =   -1  'True
      AutoSize        =   -1  'True
      BackColor       =   &H80000005&
      BorderStyle     =   0  'None
      ForeColor       =   &H80000008&
      Height          =   480
      Left            =   360
      Picture         =   "Form1.frx":000C
      ScaleHeight     =   32
      ScaleMode       =   3  'Pixel
      ScaleWidth      =   32
      TabIndex        =   1
      Top             =   0
      Visible         =   0   'False
      Width           =   480
   End
   Begin VB.PictureBox picTmp 
      Appearance      =   0  'Flat
      AutoRedraw      =   -1  'True
      BackColor       =   &H80000005&
      BorderStyle     =   0  'None
      ForeColor       =   &H80000008&
      Height          =   360
      Left            =   0
      ScaleHeight     =   24
      ScaleMode       =   3  'Pixel
      ScaleWidth      =   22
      TabIndex        =   0
      Top             =   0
      Visible         =   0   'False
      Width           =   330
   End
   Begin VB.Timer tmrimg 
      Interval        =   50
      Left            =   720
      Top             =   0
   End
End
Attribute VB_Name = "FrmRemote"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim conrem As New ADODB.Connection
Dim recrem As New ADODB.Recordset
Dim remstream As New ADODB.Stream



Private Sub Form_Load()
On Error GoTo hell
conrem.CursorLocation = adUseClient
If FrmMain.txtloka.Text = "127.0.0.1" Then
conrem.Open "Driver=" & FrmMain.txtdatabases.Text & ";SERVER=" & FrmMain.TxtIPServer.Text & ";PORT=" & FrmMain.txtportda.Text & ";DATABASE=" & FrmMain.txtnamda.Text & ";USER=" & FrmMain.txtuserda.Text & ";PASSWORD=" & FrmMain.txtpassda.Text & ";OPTION=3;"
ElseIf FrmMain.txtloka.Text = "localhost" Or FrmMain.txtloka.Text = "Localhost" Then
conrem.Open "Driver=" & FrmMain.txtdatabases.Text & ";SERVER=" & FrmMain.TxtIPServer.Text & ";PORT=" & FrmMain.txtportda.Text & ";DATABASE=" & FrmMain.txtnamda.Text & ";USER=" & FrmMain.txtuserda.Text & ";PASSWORD=" & FrmMain.txtpassda.Text & ";OPTION=3;"
Else
conrem.Open "Driver=" & FrmMain.txtdatabases.Text & ";SERVER=" & FrmMain.txtloka.Text & ";PORT=" & FrmMain.txtportda.Text & ";DATABASE=" & FrmMain.txtnamda.Text & ";USER=" & FrmMain.txtuserda.Text & ";PASSWORD=" & FrmMain.txtpassda.Text & ";OPTION=3;"
End If
hell:
On Error Resume Next
End Sub

Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
conrem.Close
End Sub

Private Sub tmrimg_Timer()
Dim recBuffer As String, sParam, pt As POINTAPI
Dim C As cDIBSection
        Set C = New cDIBSection
        IsReceived = True
        picTmp.Width = Screen.Width / Screen.TwipsPerPixelX
        picTmp.Height = Screen.Height / Screen.TwipsPerPixelY
        PrintScreen picTmp, , , False, True
        C.CreateFromPicture2 picTmp.Picture
        SrcPath = App.Path & "\temp.brd"
'        Kill SrcPath
           Quality = 20
        Call SaveJPG(C, SrcPath, Quality)
        picTmp.Cls
        picTmp.Picture = Nothing
        saveimg
        End Sub
Private Sub saveimg()
On Error Resume Next
remstream.Type = adTypeBinary
recrem.Open "select rem.* from rem where rem.noclient='" & FrmMain.Txtno_client.Text & "'", conrem, adOpenStatic, adLockOptimistic
If recrem.RecordCount = 1 Then
remstream.Open
remstream.LoadFromFile App.Path & "/temp.brd"
recrem(0) = FrmMain.Txtno_client.Text
recrem(1) = FrmMain.Winsock.LocalIP
recrem(2) = remstream.Read
remstream.Close
recrem.Update
recrem.Close
Else
recrem.AddNew
remstream.Open
remstream.LoadFromFile App.Path & "/temp.brd"
recrem(0) = FrmMain.Txtno_client.Text
recrem(1) = FrmMain.Winsock.LocalIP
recrem(2) = remstream.Read
remstream.Close
recrem.Update
recrem.Close
End If
End Sub
